package com.module.report.controller;

import com.module.common.core.controller.BaseController;
import com.module.common.core.domain.AjaxResult;
import com.module.common.core.page.TableDataInfo;
import com.module.common.utils.DateUtils;
import com.module.record.domain.RecordOnline;
import com.module.record.service.IRecordOnlineService;
import com.module.report.domain.ReportDevice;
import com.module.report.service.IReportDeviceService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 设备上下线Controller
 *
 */
@Controller
@RequestMapping("/report/device")
public class ReportDeviceController extends BaseController {

    private String prefix = "report/device";

    @Autowired
    private IReportDeviceService reportDeviceService;

    /**
     * 根据设备类型统计
     */
    @PostMapping("/type_chart")
    @ResponseBody
    public AjaxResult typeChart(ReportDevice reportDevice)
    {
        List<ReportDevice> list = reportDeviceService.selectTypeChartList(reportDevice);
        return success(list);
    }

    /**
     * 根据在线状态统计
     */
    @PostMapping("/online_chart")
    @ResponseBody
    public AjaxResult onlineChart(ReportDevice reportDevice)
    {
        List<ReportDevice> list = reportDeviceService.selectOnlineChartList(reportDevice);
        return success(list);
    }
}
